package gsw.tool.pluggable.pm.parser;

import android.content.Context;
import android.util.DisplayMetrics;

import java.io.File;

import gsw.tool.pluggable.utils.reflect.MethodUtils;

/**
 * API20Android 4.4W)的PackageParser
 * 与API21的不同之处：
 * parsePackage
 */
public class PackageParser20 extends PackageParser21 {

    public PackageParser20(Context mContext) throws Exception {
        super(mContext);
    }

    @Override
    public void parsePackage(File file, int flags) throws Exception {
        super.parsePackage(file, flags);
        DisplayMetrics metrics = new DisplayMetrics();
        metrics.setToDefaults();
        String destCodePath = file.getPath();
        mPackageParser = MethodUtils.invokeConstructor(sPackageParserClass, destCodePath);
        mPackage = MethodUtils.invokeMethod(mPackageParser, "parsePackage"
                , file, destCodePath, metrics, flags);

    }
}
